Skip to content

feat: Allow concurrent payload visiting#2230

Closed
brucearctor wants to merge 1 commit intotemporalio:masterfrom
brucearctor:feature/concurrent-payload-visiting
Closed

feat: Allow concurrent payload visiting#2230
brucearctor wants to merge 1 commit intotemporalio:masterfrom
brucearctor:feature/concurrent-payload-visiting

Conversation

@brucearctor
Copy link
Copy Markdown
Contributor

Closes #2223

This PR introduces a Concurrency configuration option inside PayloadCodecGRPCClientInterceptorOptions and NewFailureGRPCClientInterceptorOptions.

When Concurrency > 1, the proxy visitor collects payload pointers sequentially but decodes/encodes payloads concurrently using errgroup, reducing latency drastically when the codec includes heavy IO (e.g., KMS client-side encryption calls).
It avoids deep copies by directly modifying the byte vectors in place on the tree.
Fallback execution remains entirely sequential if Concurrency=1 or 0.

A unit test asserting the parallel time reduction is included.

@brucearctor brucearctor requested a review from a team as a code owner March 15, 2026 22:49
@jmaeagle99
Copy link
Copy Markdown
Contributor

Hi @brucearctor. Thanks for taking time to create a PR for this issue and for your contribution.

The intent of temporalio/features#772 was to update https://github.com/temporalio/api-go/blob/master/proxy/interceptor.go#L101C6-L101C19 to enable concurrent visiting so that it is broadly usable. This would allow concurrency regardless of the visitor callback implementation. gRPC interceptors are one type of these callback implementations.

The concurrent visiting was enabled upstream in temporalio/api-go#244 and integrated into the current repository in #2294. The gRPC interceptors themselves are not specifically aware of the concurrency enablement, but can be made concurrent using the payload visitor concurrency options.

Since the interceptors do not need concurrent visiting explicitly enabled within their implementations and can leverage the generalized concurrent visiting options, we will not accepting this PR in its current form. If you feel there are additional improvements that could be made in this space, please do not hesitate to open an issue for discussion.

@brucearctor
Copy link
Copy Markdown
Contributor Author

Makes sense. And I approx the response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable concurrent payload visiting

2 participants